<?php
/* @var $this PembayaranPinjamanController */
/* @var $model PembayaranPinjaman */
/* @var $form CActiveForm */
$cicilan = intval($model_pinjaman->JUMLAH_PINJAMAN) / intval($model_pinjaman->TERMINE);
?>

<div id="steps">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'pembayaran-pinjaman-form',
	'enableAjaxValidation'=>false,
)); ?>
<fieldset class="step">

		<?php echo $form->hiddenField($model,'ID_PINJAMAN'); ?>

	<p>
		<label for="PembayaranPinjaman[TANGGAL_TRANSAKSI]">Tanggal Transaksi</label>
		<?php //echo $form->dateField($model,'TANGGAL_TRANSAKSI'); 
			$this->widget('zii.widgets.jui.CJuiDatePicker', array(
			 'name'=>"PembayaranPinjaman[TANGGAL_TRANSAKSI]", // the name of the field
			 'value'=>($model->TANGGAL_TRANSAKSI!=null)?(date("d-m-Y", strtotime($model->TANGGAL_TRANSAKSI))):(date('d-m-Y')),  // pre-fill the value
			 // additional javascript options for the date picker plugin
			 'options'=>array(
							 'showAnim'=>'fold',
							 'dateFormat'=>'dd-mm-yy',  // optional Date formatting
							 'debug'=>true,
							 'changeYear'=> true,
							 'changeMonth'=>true
						),
			 'htmlOptions'=>array(
			 'style'=>'height:17px;'
			 ),
			 ));
		?>
		<?php echo $form->error($model,'TANGGAL_TRANSAKSI'); ?>
	</p>

	<p>
		<?php echo $form->label($model,'JUMLAH_BAYAR'); ?>
		<?php 
		
		if ($cicilan % 500 == 0){
			$c = $cicilan;
		}
		else {
			$c = round(($cicilan+500/2)/500)*500;
		}
		
		?>
		<?php echo $form->textField($model,'JUMLAH_BAYAR',array('value'=>$c)); ?>
		<?php echo $form->error($model,'JUMLAH_BAYAR'); ?>
	</p>

	<p>
		<?php echo $form->label($model,'KETERANGAN'); ?>
		<?php echo $form->textArea($model,'KETERANGAN'); ?>
		<?php echo $form->error($model,'KETERANGAN'); ?>
	</p>

	<p class="submit">
		<button id="registerButton" type="submit">Simpan</button>&nbsp;
		<button id="registerButton" type="reset">Reset</button>&nbsp;
		<button id="registerButton" type="button" onclick="window.location.href='<?php echo Yii::app()->createUrl("PembayaranPinjaman/index/".$model->ID_PINJAMAN);?>'">Kembali</button>
	</p>
</fieldset>
<?php $this->endWidget(); ?>

</div><!-- form -->